<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>v-bind 实例</title>
    <script type="text/javascript" src="../assets/js/vue.js"></script>
</head>

<body>
    <h1>v-bind 实例</h1>
    <hr>
    <div id="app">
        <p>
            <img v-bind:src="imgSrc" width="200px">
        </p>
        <a :href="webUrl" target="_blank">技术群</a>
        <hr>
        <div :class="className">1、绑定Class</div>
        <div :class="{classA:isOK}">2、绑定Class中的判断</div>
        <div :class="[classA,classB]">3、绑定Class中的数组</div>
        <div :class="isOK?classA:classB">4、绑定Class中的三元运算符</div>
        <hr>
        <div>
            <input type="checkbox" id="isOK" v-model="isOK">
            <label for="isOK">isOK={{isOK}}</label>
        </div>
        <hr>
        <div :style="{color:red,fontSize:font}">5、绑定style</div>
        <div :style="styleObject">6、对象绑定style</div>
    </div>
    <style>
        .classA {
            color: red;
        }

        .classB {
            font-size: 150%;
        }
    </style>

    <script type="text/javascript">
        var app = new Vue({
            el: '#app',
            data: {
                imgSrc: "http://c.hiphotos.baidu.com/image/h%3D300/sign=50aa64f5d0f9d72a0864161de428282a/4ec2d5628535e5ddadf7a5157fc6a7efcf1b6224.jpg",
                webUrl: "http://c.hiphotos.baidu.com",
                className: 'classA',
                isOK: false,
                classA: 'classA',
                classB: 'classB',
                red: 'red',
                font: '20px',
                styleObject: {
                    color: 'green',
                    fontSize: '25px'
                }

            }
        })
    </script>
</body>

</html>